/* eslint-disable eqeqeq */
/* eslint-disable array-callback-return */
/* eslint-disable react/destructuring-assignment */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-param-reassign */
import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { DownOutlined, UpOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import {
Row, Col, Card, Input, // Dropdown,
Button, // Menu,
// Modal,
// Radio,
// message,
// Badge,
// Divider,
// Tabs,
// Select,
DatePicker
} from 'antd';
import Link from 'umi/link';
import queryString from 'query-string';
import Customer from '../../components/Customer';
import StandardTable from '@/components/StandardTable';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import DictCode from '../../components/DictCode';
import styles from '@/utils/utils.less';
// import judegAuthority from '../judgeAuthority';

const FormItem = Form.Item;
const { RangePicker } = DatePicker;
@connect(({ socsearrch, loading, publicdata }) => ({
  loading: loading.models.socsearrch,
  data: socsearrch.data,
  dictCode: publicdata.dictCode,
  formFieldsValue: socsearrch.formFieldsValue,
  expandForm: socsearrch.expandForm,
  monthvalue: socsearrch.monthvalue,
}))
@Form.create()
class TableList extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      // certNo: null, // 证件号
      // custName: null, // 客户名称
      // startBusiYm: null, // 开始时间
      // endBusiYm: null, // 结束时间
      // empName: null, // 员工姓名
      // payType: null, // 缴费方式
      formValues: {},
      selectedRows: [],
      mode: ['month', 'month'],
      scroll: {
        x: 5250,
        y: 600,
      },
    };

    this.tableSearchLayout = {
      labelCol: { md: { span: 7 } },
      wrapperCol: { md: { span: 17 } },
    };
  }

  componentDidMount() {
    const { location, dispatch } = this.props;
    const { isMenuLink } = queryString.parse(location.search);
    // const anthority = judegAuthority(location);
    const { queryParam } = location;
    if (isMenuLink === 'true') {
      this.resetAndGeLlist(location);
    } else if (isMenuLink === 'false') {
      if (queryParam) {
        dispatch({
          type: 'socsearrch/updateModalData',
          payload: {
            formFieldsValue: queryParam,
            expandForm: true,
          },
        });
      }
      const _ = this;
      this.socsearrchSearch(_, queryParam);
    } else {
      this.socsearrchSearch();
    }
    this.getDict();
  }

  getDict = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'publicdata/fetchDictCode',
      payload: ['PAY_FEES_WAY'],
    });
  };

  // 查询列表
  socsearrchSearch = (_, queryParam) => {
    // if (e) e.preventDefault();
    const {
      dispatch,
      form,
      data: {
        pagination: { current, pageSize },
      },
    } = this.props;
    const { monthvalue } = this.props;
    form.validateFields((err, fieldsValue) => {
      if (err) return;
      if (monthvalue.length !== 0) {
        fieldsValue.dateArr = monthvalue;
      }
      fieldsValue = queryParam || fieldsValue;
      dispatch({
        type: 'socsearrch/updateModalData',
        payload: {
          formFieldsValue: fieldsValue,
        },
      });
      const formFieldsValue = {};
      Object.keys(fieldsValue).forEach(key => {
        if (key === 'empName' || key === 'certNo') {
          fieldsValue[key] = (fieldsValue[key] && fieldsValue[key].trim()) || null;
        }
        formFieldsValue[key] = fieldsValue[key] === undefined ? null : fieldsValue[key];
      });

      delete formFieldsValue.dateArr;
      setTimeout(() => {
        const pageArg = { currentPage: current, pageSize };
        const values = {
          ...formFieldsValue,
          pageArg,
          certNo: fieldsValue.certNo || null, // 证件号
          custId: fieldsValue.custId || null, // 客户名称
          empName: fieldsValue.empName || null, // 员工姓名
          payType: fieldsValue.payType || null, // 缴费方式
          startBusiYm: monthvalue.length !== 0 ? monthvalue[0].format('YYYYMM') : null,
          endBusiYm: monthvalue.length !== 0 ? monthvalue[1].format('YYYYMM') : null,
        };
        this.setState({ formValues: values });
        dispatch({
          type: 'socsearrch/fetchList',
          payload: values,
        });
      }, 0);
    });
  };

  // 重置
  handleFormReset = () => {
    // const { form } = this.props;
    // form.resetFields();
    // form.validateFields((err, fieldsValue) => {
    //   if (err) return;
    //   Object.keys(fieldsValue).forEach(key => {
    //     if (fieldsValue.dateArr) {
    //       delete fieldsValue.dateArr;
    //     }
    //     fieldsValue[key] == null;
    //   });
    //   const pageArg = { currentPage: 1, pageSizes: 10 };
    //   const values = {
    //     ...fieldsValue,
    //     pageArg,
    //     certNo: null, // 证件号
    //     custId: null, // 客户名称
    //     startBusiYm: null, // 开始时间
    //     endBusiYm: null, // 结束时间
    //     empName: null, // 员工姓名
    //     payType: null, // 缴费方式
    //   };
    //   this.setState({ formValues: values, monthvalue: [] });
    // });
    const { form, dispatch } = this.props;
    dispatch({
      type: 'socsearrch/updateModalData',
      payload: { formFieldsValue: {} },
    });
    form.resetFields();
    form.setFieldsValue({ dateArr: null });
    this.dateOnchange();
  };

  // 点击复选框
  handleSelectRows = (selectedRows, selectedRowKeys) => {
    this.setState({ selectedRows, selectedRowKeys });
  };

  // 切换表格展开收起
  toggleForm = () => {
    const { dispatch, expandForm } = this.props;
    dispatch({
      type: 'socsearrch/updateModalData',
      payload: { expandForm: !expandForm },
    });
  };

  // 表格有变化：比如：切换页码
  handleStandardTableChange = (pagination, filtersArg, sorter) => {
    const { dispatch } = this.props;
    const { formValues } = this.state;
    const getValue = obj =>
      Object.keys(obj)
        .map(key => obj[key])
        .join(',');
    const filters = Object.keys(filtersArg).reduce((obj, key) => {
      const newObj = { ...obj };
      newObj[key] = getValue(filtersArg[key]);
      return newObj;
    }, {});

    const pageArg = {
      currentPage: pagination.current,
      pageSize: pagination.pageSize,
    };
    const params = {
      ...formValues,
      ...filters,
      pageArg,
    };
    if (sorter.field) {
      params.sorter = `${sorter.field}_${sorter.order}`;
    }
    dispatch({
      type: 'socsearrch/fetchList',
      payload: params,
    });
  };

  // 缴费月份
  handlePanelChange = (value, mode) => {
    const { dispatch } = this.props;
    dispatch({
      type: 'socsearrch/updateModalData',
      payload: { monthvalue: value },
    });

    this.setState({
      mode: [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]],
    });
  };

  dateOnchange = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'socsearrch/updateModalData',
      payload: { monthvalue: [] },
    });

    this.setState({
      mode: ['month', 'month'],
    });
  };

  async resetAndGeLlist(location) {
    const { dispatch } = this.props;
    dispatch({
      type: 'socsearrch/updateModalData',
      payload: { expandForm: false },
    });
    await this.handleFormReset();
    await this.socsearrchSearch();
    dispatch({
      type: 'global/changeIsMenuLink',
      payload: location,
    });
  }

  renderSimpleForm() {
    const {
      form: { getFieldDecorator },
      formFieldsValue,
    } = this.props;
    return (
      <Form layout="inline">
        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
          <Col md={8} sm={24}>
            <FormItem label="员工姓名" {...this.tableSearchLayout}>
              {getFieldDecorator('empName', {
                initialValue: formFieldsValue.empName,
              })(<Input placeholder="请输入" />)}
            </FormItem>
          </Col>
          <Col md={8} sm={24}>
            <FormItem label="证件号：" {...this.tableSearchLayout}>
              {getFieldDecorator('certNo', {
                initialValue: formFieldsValue.certNo,
              })(<Input placeholder="请输入" />)}
            </FormItem>
          </Col>
          <Col md={8} sm={24}>
            <span className={styles.submitButtons}>
              <Button type="primary" onClick={() => this.socsearrchSearch()}>
                查询
              </Button>
              <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
                重置
              </Button>
              <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
                展开 <DownOutlined />
              </a>
            </span>
          </Col>
        </Row>
      </Form>
    );
  }

  renderAdvancedForm() {
    const {
      form: { getFieldDecorator },
      formFieldsValue,
      monthvalue,
    } = this.props;
    const { mode } = this.state;
    return (
      <Form layout="inline">
        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
          <Col md={8} sm={24}>
            <FormItem label="员工姓名" {...this.tableSearchLayout}>
              {getFieldDecorator('empName', {
                initialValue: formFieldsValue.empName,
              })(<Input placeholder="请输入" />)}
            </FormItem>
          </Col>
          <Col md={8} sm={24}>
            <FormItem label="证件号：" {...this.tableSearchLayout}>
              {getFieldDecorator('certNo', {
                initialValue: formFieldsValue.certNo,
              })(<Input placeholder="请输入" />)}
            </FormItem>
          </Col>
          <Col md={8} sm={24}>
            <FormItem label="客户名称" {...this.tableSearchLayout}>
              {getFieldDecorator('custId', {
                initialValue: formFieldsValue.custId,
              })(<Customer attr />)}
            </FormItem>
          </Col>
        </Row>
        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
          <Col md={8} sm={24}>
            <FormItem label="缴费方式" {...this.tableSearchLayout}>
              {getFieldDecorator('payType', {
                initialValue: formFieldsValue.payType,
              })(<DictCode dictType="PAY_FEES_WAY" />)}
            </FormItem>
          </Col>
          <Col md={8} sm={24}>
            <FormItem label="业务年月：" {...this.tableSearchLayout}>
              {getFieldDecorator('dateArr', {
                rules: [{ type: 'array', required: false }],
                initialValue: formFieldsValue.dateArr,
              })(
                <div>
                  <RangePicker
                    placeholder={['开始月份', '结束月份']}
                    style={{ width: '100%' }}
                    format="YYYY-MM"
                    value={monthvalue}
                    mode={mode}
                    onPanelChange={this.handlePanelChange}
                    onChange={this.dateOnchange}
                  />
                </div>
              )}
            </FormItem>
          </Col>
          <Col md={8} sm={24}>
            <div style={{ overflow: 'hidden' }}>
              <div style={{ float: 'right', marginBottom: 16 }}>
                <Button type="primary" onClick={() => this.socsearrchSearch()}>
                  查询
                </Button>
                <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
                  重置
                </Button>
                <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
                  收起
                  <UpOutlined />
                </a>
              </div>
            </div>
          </Col>
        </Row>
      </Form>
    );
  }

  renderForm() {
    const { expandForm } = this.props;
    return expandForm ? this.renderAdvancedForm() : this.renderSimpleForm();
  }

  render() {
    const { data, loading, dictCode } = this.props;
    const { selectedRows, scroll, selectedRowKeys } = this.state;
    const { pathname } = this.props.location;
    const tempUrl = pathname.split('/index')[0];
    const columns = [
      {
        title: '员工姓名',
        dataIndex: 'empName',
        width: 100,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        render: (text, record) => (
          <Link to={`${tempUrl}/detail?empId=${record.empId}`}>{text}</Link>
        ),
        fixed: 'left',
      },
      {
        title: '证件号',
        dataIndex: 'certNo',
        width: 200,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        fixed: 'left',
      },
      {
        title: '社保个人账号',
        dataIndex: 'empIndvAccoNo',
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        render: val => (val && val) || '--',
      },
      {
        title: '客户名称',
        dataIndex: 'custName',
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
      },
      {
        title: '签约方',
        dataIndex: 'ordSndrName',
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
      },
      {
        title: '缴费方式',
        dataIndex: 'payType',
        width: 100,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        render: (text, record) => {
          const yesor = record.payType;
          let name;
          if (yesor) {
            dictCode.PAY_FEES_WAY.map(c => {
              if (c.itemCode == yesor) {
                name = c.itemName;
              }
            });
          }
          return <span>{name}</span>;
        },
      },
      {
        title: '业务年月',
        dataIndex: 'busiYm',
        width: 100,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        render: text => `${`${text}`.substring(0, 4)}-${`${text}`.substring(4)}`,
      },
      {
        title: '执行地区',
        dataIndex: 'declAreaName',
        width: 100,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
      },
      {
        // title: '养老',
        title: <span style={{ textAlign: 'center', fontWeight: 'bold' }}>养老</span>,
        children: [
          {
            title: '个人账号',
            dataIndex: 'indvAccoNo_3',
            width: 180,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
            render: val => (val && val) || '--',
          },
          {
            title: '企业基数',
            dataIndex: 'unitBase_3',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人基数',
            dataIndex: 'empBase_3',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费比例(%)',
            dataIndex: 'unitProp_3',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费比例(%)',
            dataIndex: 'empProp_3',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费',
            dataIndex: 'unitAmo_3',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费',
            dataIndex: 'empAmo_3',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
        ],
      },
      {
        title: <span style={{ textAlign: 'center', fontWeight: 'bold' }}>医疗</span>,
        children: [
          {
            title: '个人账号',
            dataIndex: 'indvAccoNo_6',
            width: 180,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
            render: val => (val && val) || '--',
          },
          {
            title: '企业基数',
            dataIndex: 'unitBase_6',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人基数',
            dataIndex: 'empBase_6',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费比例(%)',
            dataIndex: 'unitProp_6',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费比例(%)',
            dataIndex: 'empProp_6',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费',
            dataIndex: 'unitAmo_6',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费',
            dataIndex: 'empAmo_6',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
        ],
      },
      {
        // title: '生育',
        title: <span style={{ textAlign: 'center', fontWeight: 'bold' }}>生育</span>,
        children: [
          {
            title: '个人账号',
            dataIndex: 'indvAccoNo_7',
            width: 180,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
            render: val => (val && val) || '--',
          },
          {
            title: '企业基数',
            dataIndex: 'unitBase_7',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人基数',
            dataIndex: 'empBase_7',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费比例(%)',
            dataIndex: 'unitProp_7',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费比例(%)',
            dataIndex: 'empProp_7',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费',
            dataIndex: 'unitAmo_7',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费',
            dataIndex: 'empAmo_7',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
        ],
      },
      {
        // title: '失业',
        title: <span style={{ textAlign: 'center', fontWeight: 'bold' }}>失业</span>,

        children: [
          {
            title: '个人账号',
            dataIndex: 'indvAccoNo_4',
            width: 180,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
            render: val => (val && val) || '--',
          },
          {
            title: '企业基数',
            dataIndex: 'unitBase_4',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人基数',
            dataIndex: 'empBase_4',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费比例(%)',
            dataIndex: 'unitProp_4',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费比例(%)',
            dataIndex: 'empProp_4',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费',
            dataIndex: 'unitAmo_4',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费',
            dataIndex: 'empAmo_4',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
        ],
      },
      {
        // title: '工伤',
        title: <span style={{ textAlign: 'center', fontWeight: 'bold' }}>工伤</span>,

        dataIndex: 'a26',
        children: [
          {
            title: '个人账号',
            dataIndex: 'indvAccoNo_5',
            width: 180,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
            render: val => (val && val) || '--',
          },
          {
            title: '企业基数',
            dataIndex: 'unitBase_5',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人基数',
            dataIndex: 'empBase_5',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费比例(%)',
            dataIndex: 'unitProp_5',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费比例(%)',
            dataIndex: 'empProp_5',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '企业缴费',
            dataIndex: 'unitAmo_5',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
          {
            title: '个人缴费',
            dataIndex: 'empAmo_5',
            width: 100,
            onCell: () => ({ style: { textAlign: 'center' } }),
            onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
          },
        ],
      },
      {
        title: '商业补充医疗保险',
        dataIndex: 'busReplenish',
        width: 100,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        render: val => <span>{val === 0 ? 0 : val || '--'}</span>,
      },
      {
        title: '大病医疗',
        dataIndex: 'weak',
        width: 100,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { textAlign: 'center', fontWeight: 'bold' } }),
        render: val => <span>{val === 0 ? 0 : val || '--'}</span>,
      },
    ];
    return (
      <PageHeaderWrapper>
        <Card className={styles.searchCard}>
          <div className={styles.tableListForm}>{this.renderForm()}</div>
        </Card>
        <Card className={styles.tableCard}>
          <StandardTable
            selectedRows={selectedRows}
            selectedRowKeys={selectedRowKeys}
            scroll={scroll}
            loading={loading}
            data={data}
            onSelectRow={this.handleSelectRows}
            rowKey={record => record.ordYmDetId || null}
            columns={columns}
            onChange={this.handleStandardTableChange}
            bordered
          />
        </Card>
      </PageHeaderWrapper>
    );
  }
}

export default TableList;
